package com.juphoon.mockdata;

import cn.hutool.core.util.StrUtil;
import com.juphoon.mockdata.service.IResponseService;
import com.juphoon.mockdata.service.impl.C22ResponseServiceImpl;
import com.juphoon.mockdata.service.impl.E06ResponseServiceImpl;
import lombok.Data;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

@Service
@Data
public class IntegrateManager {
    private final static Logger logger = LoggerFactory.getLogger("IntegrateManager");
    // 湖州
    public final static String C22 = "c22";
    // 东莞农商行
    public final static String E06 = "e06";
    // 浙商
    public final static String B06 = "b06";
    // 浙商
    public final static String C09 = "c09";
    // 温州
    public final static String C16 = "c16";
    private IResponseService response;
    private BeanFactory beanFactory;
    @Value("${bank.channel}")
    private String channel;

    public IntegrateManager(BeanFactory beanFactory) {
        this.beanFactory = beanFactory;
    }

    public IResponseService getResponse() {
        IResponseService responseService = null;
        if (StrUtil.equals(channel, E06)) {
            responseService = beanFactory.getBean(E06ResponseServiceImpl.class);
        }else if (StrUtil.equals(channel, C22)){
            responseService = beanFactory.getBean(C22ResponseServiceImpl.class);
        }
        return responseService;
    }
}
